﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FyndSharp.Data.Orm;
using System.Data;

namespace Fynd.Hermes.Web.Objects
{
    [Table("user")]
    public class UserInfomation : BaseOrmObject
    {
        [Field("user_id", DbType.String, 50, false, true, null)]
        public string Id { get; set; }
        [Field("true_name", DbType.String, false)]
        public string TrueName { get; set; }
        [Field("login_name", DbType.String, false)]
        public string LoginName { get; set; }
        [Field("password", DbType.String, false)]
        public string Password { get; set; }
        [Field("employee_number", DbType.String, false)]
        public string EmployeeNumber { get; set; }
        [Field("role_name", DbType.String, false)]
        public string RoleName { get; set; }

        public UserRole Role
        {
            get
            {
                try
                {
                    return (UserRole)Enum.Parse(typeof(UserRole), RoleName);
                }
                catch
                {
                    return UserRole.Guest;
                }
            }
        }


    }
}
